wayland: Stop abusing type hints
authorMatthias Clasen <mclasen@redhat.com>
Sat, 29 Feb 2020 17:25:51 +0000 (12:25 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 11 Mar 2020 23:35:55 +0000 (19:35 -0400)
Instead of misusing window type hints, introduce
a private flag for drag surfaces.

gdk/wayland/gdkdrag-wayland.c
gdk/wayland/gdkprivate-wayland.h
gdk/wayland/gdksurface-wayland.c

index b0430b025d7302ce8c01245725e73369d2ee9ec7..320ae27a9afee6999a5d4e3ab62f984a7f99c693 100644 (file)
@@ -197,18 +197,6 @@ gdk_wayland_drag_class_init (GdkWaylandDragClass *klass)
   drag_class->cancel = gdk_wayland_drag_cancel;
 }
 
-static GdkSurface *
-create_dnd_surface (GdkDisplay *display)
-{
-  GdkSurface *surface;
-
-  surface = gdk_surface_new_temp (display, &(GdkRectangle) { 0, 0, 100, 100 });
-
-  gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DND);
-  
-  return surface;
-}
-
 static inline GdkDragAction
 _wl_to_gdk_actions (uint32_t dnd_actions)
 {
index f472bf7759c468cb4df101f3901eff7ed0f6c9f3..6ea1a1ae6e6ef68d1693f9d3781bff3ea815f9e0 100644 (file)
@@ -199,5 +199,7 @@ void gdk_wayland_surface_restore_shortcuts (GdkSurface *surface,
 
 void gdk_wayland_surface_update_scale (GdkSurface *surface);
 
+GdkSurface * create_dnd_surface (GdkDisplay *display);
+
 
 #endif /* __GDK_PRIVATE_WAYLAND_H__ */
index 526b07f5670768ff02bd7c9e1fd9b186f390bc39..e6de133833c369bd9e14f773642d91fe4ed1fab2 100644 (file)
@@ -97,6 +97,7 @@ struct _GdkWaylandSurface
   unsigned int pending_commit : 1;
   unsigned int awaiting_frame : 1;
   unsigned int awaiting_frame_frozen : 1;
+  unsigned int is_drag_surface : 1;
   GdkSurfaceTypeHint hint;
   GdkSurface *transient_for;
   GdkSurface *popup_parent;
@@ -2363,7 +2364,7 @@ should_be_mapped (GdkSurface *surface)
   if (surface->surface_type == GDK_SURFACE_TEMP && surface->x < 0 && surface->y < 0)
     return FALSE;
 
-  if (impl->hint == GDK_SURFACE_TYPE_HINT_DND)
+  if (impl->is_drag_surface)
     return FALSE;
 
   return TRUE;
@@ -4392,3 +4393,14 @@ gdk_wayland_surface_restore_shortcuts (GdkSurface *surface,
   g_hash_table_remove (impl->shortcuts_inhibitors, seat);
 }
 
+GdkSurface *
+create_dnd_surface (GdkDisplay *display)
+{
+  GdkSurface *surface;
+
+  surface = gdk_surface_new_temp (display, &(GdkRectangle) { 0, 0, 100, 100 });
+
+  GDK_WAYLAND_SURFACE (surface)->is_drag_surface = TRUE;
+
+  return surface;
+}